import { createRouter, createWebHistory } from 'vue-router'
import Login from '../views/Login.vue'

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/dashboard',
    name: 'Dashboard',
    component: () => import('../views/Dashboard.vue'),
    children: [
      {
        path: 'system-log',
        name: 'SystemLog',
        component: () => import('../views/system/SystemLog.vue')
      },
      {
        path: 'user-management',
        name: 'UserManagement',
        component: () => import('../views/system/UserManagement.vue')
      },
      {
        path: 'department-management',
        name: 'DepartmentManagement',
        component: () => import('../views/system/DepartmentManagement.vue')
      },
      { path: 'role-management', name: 'RoleManagement', component: () => import('../views/system/RoleManagement.vue') },
      { path: 'course-management', name: 'CourseManagement', component: () => import('../views/system/CourseManagement.vue') },
      { path: 'activity-management', name: 'ActivityManagement', component: () => import('../views/system/ActivityManagement.vue') },
      { path: 'lead-management', name: 'LeadManagement', component: () => import('../views/system/LeadManagement.vue') },
      { path: 'lead-pool', name: 'LeadPool', component: () => import('../views/system/LeadPool.vue') }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router